﻿using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BtsPracCourse.GUITests.OrdersBTService;

namespace BtsPracCourse.GUITests
{
    public partial class BTRSForm : Form
    {
        public BTRSForm()
        {
            InitializeComponent();
        }

        /// <summary>
        ///  Simple example for Calling a SOAP adapter exposing a Schema
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                OrdersSoapClient clnt = new OrdersSoapClient();
                Order order = new Order();
                order.Header = new OrderHeader();
                order.Header.ClientID = 10;
                order.Header.SpecialDiscount = 0;
                order.LineItem = new OrderLineItem[1];
                order.LineItem[0] = new OrderLineItem();
                order.LineItem[0].ID = 0;
                order.LineItem[0].IDSpecified = true;
                order.LineItem[0].Price = 10;
                order.LineItem[0].PriceSpecified = true;
                order.LineItem[0].DiscountRate = 0;
                order.LineItem[0].Quantity = 10;
                order.LineItem[0].QuantitySpecified = true;
                // Open web service
                clnt.Open();
                // Call Web service
                clnt.PostNewOrder(order);
                // Done close it 
                clnt.Close();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }

        }
    }
}
